#include <iostream>
#include <string>
#include <algorithm>
#include <limits.h>
using namespace std;

class Solution {
    public:
        int reverse(int x) {
            string s;
            long long tmp = x;
            int flag = 0;
            if(x <0){
                flag = 1;
                tmp = -tmp;
            }
            s = to_string(tmp);
            int n = s.size();
            cout<<s<<endl;
            for(int i = s.size()-1; i>=0; i--){
                if(s[i] == '0'&&n>1)n--;
                else break;
            }
            cout<<n<<endl;
            string str = s.substr(0,n);
            cout<<str<<endl;
            std::reverse(str.begin(),str.end());
            cout<<str<<endl;
            long long ret = 0;
            for(int i = 0; i<n; i++){
                ret = ret *10+(str[i]-'0');
            }
            if(flag)ret  = -ret;
            if(ret>INT_MAX||ret<INT_MIN)return 0;
            else return ret;
        }
    };